#ifndef __GE_SKELETON_H__
#define __GE_SKELETON_H__

#include "GE_Base.h"
namespace Syp
{
class SYPAPI Skeleton : public Resource
{
public:
	Skeleton(const String& name);
	static Skeleton* createSkeleton(const String& name);
	static void destroySkeleton(Skeleton* sk);
	std::vector<Bone*>& getBonesRef();
	///Returns the total Animation Length 
	float getAnimLength();

	 ///Calculates the inverse matrices
	static void calcBoneInverse(Bone& b);

	void writeToFile(const String& name);
	void loadFromFile(const String& name);

	///Returns boneID from bone's name
	PInt getBoneID(const String& name);
	///Returns a reference to the bone from the name
	Bone& getBoneRef(const String& name);
	///Returns a reference to the bone from the ID
	Bone& getBoneRef(const short ID);
	///Returns the number of bones
	PInt getNumBones();
protected:
	~Skeleton();
private:
	///The Bones and all their animations
	std::vector<Bone*> Bones;

	///Total length of this animation for this mesh in seconds
	float AnimLength;

	friend void IndexedMesh::useSkeleton(Skeleton* sk);
	friend IndexedMesh::~IndexedMesh();
};

}
#endif //__GE_SKELETON_H__

